/*
 * @Description:
 * @Author: wangyan
 * @Date: 2021-02-27 15:13:38
 * @LastEditTime: 2021-03-06 14:34:59
 * @LastEditors: @yzcheng
 */
import { CHECC_API_PROCESS,CHECC_API_PROCESS_FORM,CHECC_API_CMS } from '@/constant/proxy'
import request from '@/utils/request'

// 保存流程信息
export function saveBpmnXML(params) {
    return request({
        url: CHECC_API_PROCESS + '/flowFile/createFile',
        method: 'post',
        data: params,
    })
}

// 获取流程列表
export function getBpmnList({ params, data }) {
    return request({
        url: CHECC_API_PROCESS + '/flowFile/page',
        method: 'post',
        params,
        data,
    })
}

// 获取某流程详细信息
export function getBpmnById(params) {
    return request({
        url: CHECC_API_PROCESS + "/flowFile/findById/" + params?.id,
        method: 'get',
        params
    })
}

// 删除流程
export function delBpmn(params) {
    return request({
        url: CHECC_API_PROCESS + '/flowFile/delete/',
        method: 'delete',
        params,
    })
}

// 更新bpmn xml
export function updateBpmnById(data) {
    return request({
        url: CHECC_API_PROCESS + '/flowFile/update/',
        method: 'post',
        data,
    })
}

// 获取流程类型列表
export function requestFlowType(params) {
    return request({
        url: CHECC_API_PROCESS + '/flow-classify/getList',
        method: 'get',
        params
    })
}

// 获取用户信息列表
export function requestUserList(params) {
    return request({
        url: CHECC_API_CMS + '/user',
        method: 'get',
        params
    })
}

// 获取角色信息列表
export function requestRoleList(params,data) {
    return request({
        url: CHECC_API_CMS + '/role/getList',
        method: 'post',
        params,
        data:data,
    })
}

// 获取机构信息列表
export function requestOrgList() {
    return request({
        url: CHECC_API_CMS + '/org',
        method: 'get'
    })
}

export function requestDeploymentProcess(params) {
    return request({
        url: CHECC_API_PROCESS + "/act/rep/deployment/" + params?.id,
        method: "post"
    })
}

export function requestListenersList() {
    return request({
        url: CHECC_API_PROCESS + "/flow-listener",
        method: "get"
    })
}

export function requestFormTmpList(data) {
    return request({
        url: CHECC_API_PROCESS_FORM + "/fd-attribute-group/list",
        method: "post",
        data
    })
}

export function requestModelFormList(params) {
    return request({
        url: CHECC_API_PROCESS_FORM + "/flow-form/tree",
        method: "get",
        params
    })
}


export function requestAuthoritiesList(params) {
    return request({
        url: CHECC_API_PROCESS + "/flow-authority",
        method: "get",
        params
    })
}



// 预览文件
export function downloadBpmnFile(proInsId, procDefId) {
    return request({
        url: CHECC_API_PROCESS + '/act/rep/view',
        method: 'get',
        params: {
            proInsId,
            procDefId,
            resType: "bpmn",
        },
    })
}

// 获取服务任务执行列表
export function getServiceExecuteList(data){
    return request({
        url: CHECC_API_PROCESS + `/flow-servicetask-execute/list`,
        method: 'post',
        data,
    })
}